﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Deepforest.TweetMe.UI.Properties;

namespace Deepforest.TweetMe.UI
{
    /// <summary>
    /// Interaction logic for SettingsDialog.xaml
    /// </summary>
    public partial class SettingsDialog : Window
    {
        public string UserName { get; set; }
        public string Password { get; set; }

        public SettingsDialog()
        {
            DataContext = this;

            UserName = Settings.Default.UserName;
            Password = Settings.Default.Password;

            InitializeComponent();

            PasswordBox.Password = Password;
            TextBoxUserName.Focus();
        }

        private void ButtonContinue_Click(object sender, RoutedEventArgs e)
        {
            Settings.Default.UserName = UserName;
            Settings.Default.Password = Password;
            Settings.Default.Save();

            DialogResult = true;
        }

        private void PasswordBox_PasswordChanged(object sender, RoutedEventArgs e)
        {
            var passwordBox = sender as PasswordBox;
            Password = passwordBox.Password;
        }
    }
}
